<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>密码登录网站</title>
    <style>
        #dl{
            width: 300px;
            height: 200px;
            margin: 50px auto;
            background-color: #eee;
            padding: 30px;
        }
    </style>
</head>

<body>
    <div id="dl">
        <div >用户名:<input type="text" id="yhm"> </div>
        <div>密码:&nbsp;&nbsp;&nbsp;<input type="password" id="mm"> </div>
        <button id="an">登录</button>
    </div>
    <script>
        var ymh=document.getElementById('yhm');
        var mm=document.getElementById('mm');
        var an=document.getElementById('an');
        var i=[];
        var j=[];
        ymh.onkeydown=function(e){
            i.push(e.keyCode);   
        }
        mm.onkeydown=function(e){
            j.push(e.keyCode);
        }
        an.onclick=function(){
         
           if(i!='229,229,229'){
            alert('你输入的用户名错误')
           }
         else if(j!='97,98,99,100,101,102'){
            alert('你输入的密码错误');
           }
           else
           location='https://www.imooc.com/?mc_marking=16bee994c7ccca8ed8f6747c1405d1ef&mc_channel=bdocpc1&sem=1?utm_source=baidu-pc&utm_medium=sem1&utm_campaign=brand-xg&utm_content=home&utm_term=%C6%B7%C5%C6%CF%E0%B9%D8&bd_vid=6692610711340819423';
        }
    </script>
</body>

</html>